package com.ruoyi.common.enums.common;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.ruoyi.common.config.jackson.IEnumDeserializer;
import com.ruoyi.common.core.text.Convert;
import lombok.Getter;

/**
 * @Classname StatusEnum
 * @Author: sunluquan
 * @Date: 2021/12/17 14:47
 * @Description TODO
 * 通用状态枚举类
 */
@Getter
@JsonDeserialize(using = IEnumDeserializer.class)
public enum State implements IEnum<Integer> {
    OK(1, "正常"), DISABLE(0, "停用");
    @JsonValue
    private final int value;
    private final String info;

    State(int value, String info)
    {
        this.value = value;
        this.info = info;
    }
    @Override
    public Integer getValue()
    {
        return value;
    }

    public String getInfo()
    {
        return info;
    }

    @Override
    public String toString() {
        return Convert.toStr(this.value);
    }
}
